<?php
namespace app\admin\model;
use think\Db;
use think\Model;

class BusOrderModel extends Model
{
	 public function __construct()
    {
        parent::__construct();

    }
    public function getOrderList($page=1,$limit=10,$map=array(),$field = '*'){
    	return Db::name('bus_order')->page($page,$limit)->where($map)->field($field)->order('order_id desc')->select();
    }

    public function getOrderById($order_id,$field='a.*')
    {
        return Db::name("bus_order a")->join('user b','b.uid=a.uid','LEFT')
        ->field($field)->where(array('order_id'=>$order_id))->find();
    }

    public function getDriverMoneyList($page,$limit,$map=array(),$field = 'a.*'){
        return Db::name('driver_money a')->join(['xm_driver_base'=>'b'],'a.driver_id = b.driver_id','LEFT')
            ->page($page,$limit)->where($map)->field($field)->order('id desc')->select();
    }
}
